import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '所在部门名称',
    align:"center",
    dataIndex: 'personDepartmentName'
   },
   {
    title: '人员姓名',
    align:"center",
    dataIndex: 'personName'
   },
   {
    title: '学/工号',
    align:"center",
    dataIndex: 'personCode'
   },
   {
    title: '设备标识码',
    align:"center",
    dataIndex: 'deviceSn'
   },
   {
    title: '设备名称',
    align:"center",
    dataIndex: 'deviceName'
   },
   {
    title: '刷卡方式',
    align:"center",
    dataIndex: 'accessMethod_dictText'
   },
   {
    title: '图像抓拍',
    align:"center",
    dataIndex: 'snapLink',
    slots: { customRender: 'img' },
   },
   {
    title: '刷卡卡号',
    align:"center",
    dataIndex: 'cardNo'
   },
   {
    title: '通行时间',
    align:"center",
    dataIndex: 'accessDate'
   },
   {
    title: '上送时间',
    align:"center",
    dataIndex: 'seedDate'
   }
];

export const visiterColumns: BasicColumn[] = [
   {
    title: '设备标识码',
    align:"center",
    dataIndex: 'deviceSn'
   },
   {
    title: '设备名称',
    align:"center",
    dataIndex: 'deviceName'
   },
   {
    title: '刷卡方式',
    align:"center",
    dataIndex: 'accessMethod_dictText'
   },
   {
    title: '图像抓拍',
    align:"center",
    dataIndex: 'snapLink',
    slots: { customRender: 'img' },
   },
   {
    title: '刷卡卡号',
    align:"center",
    dataIndex: 'cardNo'
   },
   {
    title: '通行时间',
    align:"center",
    dataIndex: 'accessDate'
   },
   {
    title: '上送时间',
    align:"center",
    dataIndex: 'seedDate'
   }
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "所在部门名称",
      field: 'personDepartmentName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "人员姓名",
      field: 'personName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "学/工号",
      field: 'personCode',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "设备名称",
      field: 'deviceName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "刷卡方式",
      field: 'accessMethod',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"accessMethod"
      },
      //colProps: {span: 6},
 	},
     {
      label: "通行时间",
      field: "accessDate",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	}
];
//查询数据
export const visiterSearchFormSchema: FormSchema[] = [
	{
      label: "设备名称",
      field: 'deviceName',
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "刷卡方式",
      field: 'accessMethod',
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"accessMethod"
      },
      //colProps: {span: 6},
 	},
     {
      label: "通行时间",
      field: "accessDate",
      component: 'RangePicker',
      componentProps: {
          valueType: 'Date',
          showTime:true
      },
      //colProps: {span: 6},
	}
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '学/工号',
    field: 'personCode',
    component: 'Input',
  },
  {
    label: '人员姓名',
    field: 'personName',
    component: 'Input',
  },
  {
    label: '所在部门名称',
    field: 'personDepartmentName',
    component: 'Input',
  },
  {
    label: '设备标识码',
    field: 'deviceSn',
    component: 'Input',
  },
  {
    label: '设备名称',
    field: 'deviceName',
    component: 'Input',
  },
  {
    label: '点位名称',
    field: 'addrName',
    component: 'Input',
  },
  {
    label: '刷卡方式',
    field: 'accessMethod',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"accessMethod"
     },
  },
  {
    label: '刷卡卡号',
    field: 'cardNo',
    component: 'Input',
  },
  {
    label: '图像抓拍',
    field: 'snapLink',
    component: 'Input',
  },
  {
    label: '通行时间',
    field: 'accessDate',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '通行序号',
    field: 'passingNo',
    component: 'Input',
  },
  {
    label: '是否离线上送',
    field: 'isOfflineSeed',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"offline_record"
     },
  },
  {
    label: '上送时间',
    field: 'seedDate',
    component: 'DatePicker',
    componentProps: {
       showTime: true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
  },
  {
    label: '体温',
    field: 'temperature',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  personCode: {title: '学/工号',order: 0,view: 'text', type: 'string',},
  personName: {title: '人员姓名',order: 1,view: 'text', type: 'string',},
  personDepartmentName: {title: '所在部门名称',order: 2,view: 'text', type: 'string',},
  deviceSn: {title: '设备标识码',order: 3,view: 'text', type: 'string',},
  deviceName: {title: '设备名称',order: 4,view: 'text', type: 'string',},
  addrName: {title: '点位名称',order: 5,view: 'text', type: 'string',},
  accessMethod: {title: '刷卡方式',order: 6,view: 'radio', type: 'string',},
  cardNo: {title: '刷卡卡号',order: 7,view: 'text', type: 'string',},
  snapLink: {title: '图像抓拍',order: 8,view: 'text', type: 'string',},
  accessDate: {title: '通行时间',order: 9,view: 'datetime', type: 'string',},
  passingNo: {title: '通行序号',order: 10,view: 'text', type: 'string',},
  isOfflineSeed: {title: '是否离线上送',order: 11,view: 'radio', type: 'string',},
  seedDate: {title: '上送时间',order: 12,view: 'datetime', type: 'string',},
  temperature: {title: '体温',order: 13,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}